package com.andy.wang.pojo;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.Value;
import org.apache.http.annotation.Contract;

/**
 *
 * @TableName user
 */
@TableName(value ="user")
@Data
public class User implements Serializable {
    /**
     * 用户ID
     */
    @TableId(type = IdType.AUTO)
    @TableField("uID")
    @JsonProperty
    private Long uid;

    /**
     * 用户姓名
     */
    @TableField("uName")
    @JsonProperty
    private String uName;

    /**
     * 用户性别
     */
    @TableField("uSex")
    @JsonProperty
    private String uSex;

    /**
     * 用户年龄
     */
    @TableField("uAge")
    @JsonProperty
    private Integer uAge;

    /**
     * 用户手机号
     */
    @TableField("uPhone")
    @JsonProperty
    private String uPhone;

    /**
     * 用户身份证号
     */
    @TableField("uIdentity")
    @JsonProperty
    private String uIdentity;

    /**
     * 用户地址
     */
    @TableField("uAddress")
    @JsonProperty
    private String uAddress;

    /**
     * 用户爱好，多个爱好之间用逗号隔开
     */
    @TableField("uhobby")
    @JsonProperty
    private String uhobby;

    /**
     * 用户图片
     */
    @TableField("uphoto")
    @JsonProperty
    private String uphoto;

    /**
     * 用户创建账号时间
     */
    @TableField("uCreated")
    @JsonProperty
    private Date uCreated;

    /**
     * 个性签名
     */
    @TableField("signature")
    @JsonProperty
    private String signature;

    /**
     * 个性背景图片
     */
    @TableField("signatureIMG")
    @JsonProperty
    private String signatureIMG;

    /**
     * 用户状态【1.普通用户  2.VIP用户】
     */
    @TableField("ustatusID")
    @JsonProperty
    private Integer ustatusID;

    /**
     * 用户信誉值  【默认100，分级进行惩罚】
     */
    @TableField("uReputation")
    @JsonProperty
    private Integer uReputation;

    /**
     * 聊天是否禁止【0.默认无惩罚   1.禁止聊天功能】
     */
    @TableField("chatBan")
    @JsonProperty
    private Integer chatBan;

    /**
     * 聊天功能被禁止的当前时间
     */
    @TableField("BanCreatedDT")
    @JsonProperty

    private Date banCreatedDT;

    /**
     * 禁止聊天功能多少时间
     */
    @TableField("BanDataTime")
    @JsonProperty
    private String banDataTime;

    /**
     * 禁止聊天功能原因
     */
    @TableField("BeanMessage")
    @JsonProperty
    private String beanMessage;

    /**
     * 是否删除 【0.不删除  1.逻辑删除】
     */

    @TableField("isDeleted")
    @JsonProperty
    @TableLogic     // 逻辑删除
    private Integer isDeleted;


    /**
     * 最后的聊天
     */
    @TableField(exist = false)   // MybatisPlus解决实体类的此属性不用去匹配数据库
    private Chitchat chitchat;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        User other = (User) that;
        return (this.getUid() == null ? other.getUid() == null : this.getUid().equals(other.getUid()))
            && (this.getUName() == null ? other.getUName() == null : this.getUName().equals(other.getUName()))
            && (this.getUSex() == null ? other.getUSex() == null : this.getUSex().equals(other.getUSex()))
            && (this.getUAge() == null ? other.getUAge() == null : this.getUAge().equals(other.getUAge()))
            && (this.getUPhone() == null ? other.getUPhone() == null : this.getUPhone().equals(other.getUPhone()))
            && (this.getUIdentity() == null ? other.getUIdentity() == null : this.getUIdentity().equals(other.getUIdentity()))
            && (this.getUAddress() == null ? other.getUAddress() == null : this.getUAddress().equals(other.getUAddress()))
            && (this.getUhobby() == null ? other.getUhobby() == null : this.getUhobby().equals(other.getUhobby()))
            && (this.getUphoto() == null ? other.getUphoto() == null : this.getUphoto().equals(other.getUphoto()))
            && (this.getUCreated() == null ? other.getUCreated() == null : this.getUCreated().equals(other.getUCreated()))
            && (this.getSignature() == null ? other.getSignature() == null : this.getSignature().equals(other.getSignature()))
            && (this.getSignatureIMG() == null ? other.getSignatureIMG() == null : this.getSignatureIMG().equals(other.getSignatureIMG()))
            && (this.getUstatusID() == null ? other.getUstatusID() == null : this.getUstatusID().equals(other.getUstatusID()))
            && (this.getUReputation() == null ? other.getUReputation() == null : this.getUReputation().equals(other.getUReputation()))
            && (this.getChatBan() == null ? other.getChatBan() == null : this.getChatBan().equals(other.getChatBan()))
            && (this.getBanCreatedDT() == null ? other.getBanCreatedDT() == null : this.getBanCreatedDT().equals(other.getBanCreatedDT()))
            && (this.getBanDataTime() == null ? other.getBanDataTime() == null : this.getBanDataTime().equals(other.getBanDataTime()))
            && (this.getBeanMessage() == null ? other.getBeanMessage() == null : this.getBeanMessage().equals(other.getBeanMessage()))
            && (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getUid() == null) ? 0 : getUid().hashCode());
        result = prime * result + ((getUName() == null) ? 0 : getUName().hashCode());
        result = prime * result + ((getUSex() == null) ? 0 : getUSex().hashCode());
        result = prime * result + ((getUAge() == null) ? 0 : getUAge().hashCode());
        result = prime * result + ((getUPhone() == null) ? 0 : getUPhone().hashCode());
        result = prime * result + ((getUIdentity() == null) ? 0 : getUIdentity().hashCode());
        result = prime * result + ((getUAddress() == null) ? 0 : getUAddress().hashCode());
        result = prime * result + ((getUhobby() == null) ? 0 : getUhobby().hashCode());
        result = prime * result + ((getUphoto() == null) ? 0 : getUphoto().hashCode());
        result = prime * result + ((getUCreated() == null) ? 0 : getUCreated().hashCode());
        result = prime * result + ((getSignature() == null) ? 0 : getSignature().hashCode());
        result = prime * result + ((getSignatureIMG() == null) ? 0 : getSignatureIMG().hashCode());
        result = prime * result + ((getUstatusID() == null) ? 0 : getUstatusID().hashCode());
        result = prime * result + ((getUReputation() == null) ? 0 : getUReputation().hashCode());
        result = prime * result + ((getChatBan() == null) ? 0 : getChatBan().hashCode());
        result = prime * result + ((getBanCreatedDT() == null) ? 0 : getBanCreatedDT().hashCode());
        result = prime * result + ((getBanDataTime() == null) ? 0 : getBanDataTime().hashCode());
        result = prime * result + ((getBeanMessage() == null) ? 0 : getBeanMessage().hashCode());
        result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" {");
        sb.append("Hash : ").append(hashCode());
        sb.append(", uid:").append(uid);
        sb.append(", uName:").append(uName);
        sb.append(", uSex:").append(uSex);
        sb.append(", uAge:").append(uAge);
        sb.append(", uPhone:").append(uPhone);
        sb.append(", uIdentity:").append(uIdentity);
        sb.append(", uAddress:").append(uAddress);
        sb.append(", uhobby:").append(uhobby);
        sb.append(", uphoto:").append(uphoto);
        sb.append(", uCreated:").append(uCreated);
        sb.append(", signature:").append(signature);
        sb.append(", signatureIMG:").append(signatureIMG);
        sb.append(", ustatusID:").append(ustatusID);
        sb.append(", uReputation:").append(uReputation);
        sb.append(", chatBan:").append(chatBan);
        sb.append(", banCreatedDT:").append(banCreatedDT);
        sb.append(", banDataTime:").append(banDataTime);
        sb.append(", beanMessage:").append(beanMessage);
        sb.append(", isDeleted:").append(isDeleted);
        sb.append(", serialVersionUID:").append(serialVersionUID);
        sb.append("}");
        return sb.toString();
    }
}
